import java.lang.Math;
import java.util.List;
import java.util.ArrayList;
import java.util.LinkedList;

class PrimeNumbersFounder {

	private static final String NO_DIVISORS = "Your number doesn't have prime divisors.";
	private static final String DIVISORS = "Your number have following divisors: ";
	private static final int MIN_PRIME_NUMBER = 2;
	private int testValue;
	
	public PrimeNumbersFounder(){
		testValue = new ConsoleReaderUtility().readInteger("Enter an integer to find prime numbers for: ");
	}

	public static void main(String[] args){
		PrimeNumbersFounder primeNumbersTester = new PrimeNumbersFounder();

		List<Integer> primeDivisors = new LinkedList<Integer>();

		for (int currentValue=MIN_PRIME_NUMBER; currentValue <= primeNumbersTester.getTestValue(); currentValue++){
			if (primeNumbersTester.isPrime(currentValue)) {
				primeDivisors.add(currentValue);
			}
		}
		
		primeNumbersTester.printDivisors(primeDivisors);
	}
	
	public boolean isPrime(int testedValue){

		int maxPossibleDivisor = (int) Math.sqrt(testedValue);
		
		for (int possibleDivisor = MIN_PRIME_NUMBER; possibleDivisor <= maxPossibleDivisor; possibleDivisor++){
			if(testedValue % possibleDivisor == 0){
				return false;
			}
		}
		
		return true;
	}
	
	private void printDivisors(List divisors){
		if (divisors.isEmpty()) {
			System.out.print(NO_DIVISORS);
			return;
		}
		
		System.out.print(DIVISORS);
		System.out.println(divisors);
	}
	
	private int getTestValue(){
		return testValue;
	}

}